package org.autotestcase.ui.taglib;

import javax.faces.component.UIComponent;
import javax.faces.webapp.UIComponentTag;

public class UIDynamicIdTag extends UIComponentTag {
	private String id;
	private String value;

	/**
	 * @return the id
	 */
	public String getId() {
		return id;
	}

	/**
	 * @param id
	 *            the id to set
	 */
	public void setId(String id) {
		this.id = id;
	}

	/**
	 * @return the value
	 */
	public String getValue() {
		return value;
	}

	/**
	 * @param value
	 *            the value to set
	 */
	public void setValue(String value) {
		this.value = value;
	}

	@Override
	public String getComponentType() {
		return "org.autotestcase.ui.DynamicId";
	}

	@Override
	public String getRendererType() {
		return "org.autotestcase.ui.DynamicIdRenderer";
	}

	protected void setProperties(UIComponent component) {
		// the super class method should be called
		super.setProperties(component);
		
		if(id != null) {
			component.getAttributes().put("id", id);
		}
		if(value != null) {
			component.getAttributes().put("value", value);
		}
	}
}
